"""template of your bot"""
from __future__ import annotations

import asyncio
import os

from dotenv import load_dotenv
from wechaty import Wechaty, WechatyOptions
from wechaty_plugin_contrib.contrib import (
    RoomInviterOptions,

)
from wechaty_plugin_contrib.contrib.ding_dong_plugin import DingDongPlugin
from wechaty_plugin_contrib.matchers import (
    MessageMatcher,
    RoomMatcher
)
from wechaty_plugin_contrib.message_controller import message_controller

from src.plugins.howlaisi.howlaisi_chatgpt_plugin import HowlaisiChatgptPlugin
from src.plugins.howlaisi.howlaisi_join_room_plugin import HowlaisiJoinRoomPlugin
from src.plugins.howlaisi.howlaisi_on_friendship_plugin import HowlaisiOnFriendshipPlugin

if __name__ == "__main__":
    load_dotenv()
    options = WechatyOptions(
        port=os.environ.get('port', 8004)
    )
    bot = Wechaty(options)
    bot.use([
        DingDongPlugin(),
        HowlaisiChatgptPlugin(),
        HowlaisiJoinRoomPlugin(options=RoomInviterOptions(
            name='HowlaisiJoinRoomPlugin',
            rules={
                MessageMatcher('进群1'): RoomMatcher('个人云原生1'),
            },
            welcome='欢迎入群 ～'
        )),
        # 被添加好友，默认被加所有
        HowlaisiOnFriendshipPlugin(),

    ])

    message_controller.init_plugins(bot)
    asyncio.run(bot.start())
